﻿@using CoralNode.Core.Entity.Enums
@model CoralNode.Core.Client.Models.NodeStructModel
<div id="pbody" class="pbody_style2">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_setting"></span><span class="t t_c">快速设置</span>
        </div>
        <form id="spform" action="/m/quickSetting/SettingNodeStruct" method="post" enctype="multipart/form-data">
            <div id="main">
                <div class="step">
                    <ul>
                        <li><span class="ico ico_step_over"></span><span class="t">基本信息</span>
                        </li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_over"></span><span class="t">扩展信息</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_current"></span><span class="t">内容结构</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">菜单结构</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">网站外观</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">权限设置</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">性能设置</span></li>
                    <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">完成</span></li>
                    </ul>
                </div>
                <div class="table_form form_main step_content" data-js="setting_field">
                    @foreach (var pro in ViewBag.PrototypeList) {
                        <div class="box clearfix">
                            <div class="c_prototype" style="background-color: #eff2f5">@pro.Title（@pro.Code）
                            </div>
                            <div class="clearfix" style="background-color: #ffffff;">
                                <div class="box_child">
                                    <h3>字段</h3>
                                    <div>
                                        <table class="clearfix">
                                            <tbody>
                                                @foreach (var item in pro.FieldList) {
                                                    <tr>
                                                        <th>@item.Title:</th>
                                                        <td>
                                                            @if (@item.FieldType == NodeEnums.BasicFieldType.TextField) {
                                                                <input class="text w_25" type="text" disabled="disabled" value="" />
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.TextArea) {
                                                                <textarea disabled="disabled" class="h_8 w_25"></textarea>
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.PasswordField) {
                                                                <input class="text w_25" type="password" disabled="disabled" value="" />
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.RadioButton) {
                                                                <label class="mr_2">
                                                                    <input class="radio" checked="checked" disabled="disabled" type="radio"><span></span></label>
                                                                
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.CheckBox) {
                                                                <label class="mr_2">
                                                                    <input class="checkbox" disabled="disabled" type="checkbox"><span></span></label>

                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.SelectBox) {
                                                                <select style="width: 250px" disabled="disabled"></select>
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.FileField) {
                                                                <div class="field_file"></div>
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.MultiFile) {
                                                                <div class="field_file"></div>
                                                                <div class="field_file"></div>
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.ImageField) {
                                                                <div class="field_pic"></div>
                                                            } else if (@item.FieldType == NodeEnums.BasicFieldType.MultiImage) {
                                                                <div class="field_pic"></div>
                                                                <div class="field_pic"></div>
                                                            } else {
                                                                <div class="field_editer" style="width: 260px;">
                                                                    <div class="t" style="width: 260px"></div>
                                                                    <textarea disabled="disabled" class="h_8 w_25"></textarea>
                                                                </div>
                                                            }
                                                        </td>
                                                    </tr>
                                                }
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <div class="box_child c js-load">
                                    <h3>分类</h3>
                                    <div>
                                        <ul class="js-odd">
                                            @foreach (var item in @pro.CategoryList) {
                                                if (item.ParentId > 0) {
                                                <li><span class="ico ico_child ml_@item.Path"></span>@item.Title</li>
                                                } else {
                                                <li>@item.Title</li>
                                                }
                                            }
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    }
                    <div class="box clearfix">
                        <div class="c_prototype clearfix">
                            @Html.TextBoxFor(m => m.ProTitle, new { @class = "text w_15 js-watermark required ", @msg = "原型名称" })
                            @Html.TextBoxFor(m => m.ProCode, new { @class = "text w_15 js-watermark required", @msg = "原型编码" })
                            @Html.HiddenFor(m => m.ProId)
                        </div>
                        <div class="clearfix" style="background-color: #ffffff;">
                            <div class="box_child" id="js-field-c">
                                <h3>字段</h3>
                                <div>
                                    <ul class="field_list js-field clearfix"></ul>
                                    <div class="btn_fun">
                                        <label class="fun">
                                            <input type="button" class="btn_3 mb_1-5 r js-add"></label>
                                        <ul class="field_type js-field-add">
                                            @foreach (var item in ViewBag.FieldTypeList) {
                                                <li data-type="@item.Value">@item.Key</li>
                                            }
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="box_child c js-field-c">
                                <h3>分类</h3>
                                <div>
                                    @Html.TextAreaFor(m => m.Category, new { @class = "w_30 h_20 required" })
                                    <p class="l pl_1">请用回车键隔开分类，用"-"代表子分类</p>
                                </div>
                            </div>
                        </div>
                        <div class="b_footer clearfix">
                            <input type="submit" class="btn_2" value="添加">
                        </div>
                    </div>
                </div>
                <div class="ml_34 p_2">
                    <a class="btn_1 mr_2 enable" href="/m/quickSetting/SettingSiteExtend">上一步</a><a class="btn_1"
                        href="/m/quickSetting/SettingMenu">下一步</a>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $(document).ready(function () {

        $('.js-add').click(function () {
            $('.js-field-add').show();
        });
        $('.js-odd li:odd').css("background-color", "#ffffff");
        $('.js-load').each(function () {
            $(this).height($(this).prev('.box_child').height());
        });
        $('.js-field-add li').click(function () {
            var type = $(this).attr('data-type');
            var html = '<li class="clearfix"><label>字段名称：</label><input type="text" class="text w_25" name="remark" /><label>字段代码：</label><input type="text" class="text w_25" name="name" /> <input type="hidden" name="FieldJson" value=' + '{"type":"' + type + '","remark":"","name":""}' + '></li>';
            $('.js-field').append(html);
            $('.js-field-c').height($('#js-field-c').height());
            $('.js-field-add').hide();
        });

    });
</script>
